
// 若request.js在src/utils/，User.js在src/Api/，则路径正确
import request from "../utils/request.js";
console.log('导入的request：', request);
// 登录请求（优化：参数用对象形式，更灵活）
export function login(data) {
    return request({
        url: 'user/login', // 完整请求地址 = baseURL + url → http://localhost:8090/user/login
        method: 'post',
        data // 传递账号密码（{username: 'xxx', password: 'xxx'}）
    });
}
export function register(data) {
    return request({
        url: 'user/register',
        method: 'post',
        data
    });
}

export function getStudents(params) {
    return request({
        url: 'user/getStudents',
        method: 'get',
        params
    });
}

export function addStudent(data) {
    return request({
        url: 'user/addStudent',
        method: 'post',
        data
    });
}

export function deleteStudent(data) {
    return request({
        url: 'user/deleteStudent',
        method: 'post',
        data
    });

}

export function searchStudents(data){
    return request({
        url: 'user/searchStudents',
        method: 'post',
        data
    });
}

export function updateStudent(data){
    return request({
        url: 'user/updateStudent',
        method: 'post',
        data
    });
}

export function getStuNumber(params){
    return request({
        url: 'user/getStuNumber',
        method: 'get',
        params
    });
}